using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace SlamCms.SharePoint.Features.SlamCMS_Publishing
{
	/// <summary>
	/// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
	/// </summary>
	/// <remarks>
	/// The GUID attached to this class may be used during packaging and should not be modified.
	/// </remarks>

	[Guid("8cd29309-389f-4b46-b532-2bc0bab2653c")]
	public class PublishingFeatureReceiver : SPFeatureReceiver
	{
		public override void FeatureInstalled(SPFeatureReceiverProperties properties)
		{
			SPWebService service = SPWebService.ContentService;
			SPWcfServiceSettings settings = new SPWcfServiceSettings();
			settings.ReaderQuotasMaxStringContentLength = Int32.MaxValue;
			settings.ReaderQuotasMaxArrayLength = Int32.MaxValue;
			settings.ReaderQuotasMaxBytesPerRead = Int32.MaxValue;
			settings.MaxReceivedMessageSize = Int32.MaxValue;
			settings.MaxBufferSize = Int32.MaxValue;
			settings.ReaderQuotasMaxBytesPerRead = Int32.MaxValue;
			settings.ReaderQuotasMaxDepth = Int32.MaxValue;
			settings.ReaderQuotasMaxNameTableCharCount = Int32.MaxValue;

			service.WcfServiceSettings["UserManagementService.svc"] = settings;

			service.Update(true);
		}
	}
}
